import {request} from "./request"

//发送/删除评论
export function comment(t,type,id,content,commentId){
    return request({
        method:"post",
        url:"/comment",
        withCredentials: true,
        data:{
            t,
            type,
            id,
            content,
            commentId,
            timerstamp:Date.now()
        }
    })
}
//新版评论接口
export function new_comment(id, type, pageNo , pageSize ){
    return request({
        url:'/comment/new',
        withCredentials: true,
        params:{
            id,
            type,
            pageNo,
            pageSize,
            timerstamp:Date.now()
        }
    })
}
//热门评论
export function comment_hot(id,type){
    return request({
        url:'/comment/hot',
        withCredentials: true,
        params:{
            id,
            type,
            timerstamp:Date.now()
        }
    })
}
//歌单评论
export function comment_playlist(id, limit ,offset){
    return request({
        url:"/comment/playlist",
        withCredentials: true,
        params:{
            id,
            limit,
            offset,
            timerstamp:Date.now()
        }
    })
}
//专辑评论
export function comment_album(id, limit ,offset){
    return request({
        url:'/comment/album',
        withCredentials: true,
        params:{
            id,
            limit,
            offset,
            timerstamp:Date.now() 
        }
    })
}
//歌曲评论
export function comment_music(id, limit ,offset){
    return request({
        url:'/comment/music',
        withCredentials: true,
        params:{
            id,
            limit,
            offset,
            timerstamp:Date.now() 
        }
    })
}

//评论点赞
export function likeComment(id, cid, t, type) {
    return request({
        url: '/comment/like',
        method:"post",
        withCredentials: true,
        data:{
            id, 
            cid, 
            t, 
            type,
            timerstamp:Date.now()
        }
    })
}
//删除歌单
export function playlist_delete(id){
     return request({
         url:"/playlist/delete",
         withCredentials: true,
         params:{
             id
         }
     })
}
//新建歌单
export function playlist_create(name , type){
   return request({
       url:"/playlist/create",
       withCredentials : true,
       params:{
           name,
           type
       }
   })
}
//对歌单添加或删除歌曲  op: 增加单曲为 add, 删除为 del /  pid: 歌单/ tracks: 歌曲 id
export function playlist_tracks(op, pid , tracks){
    return request({
        withCredentials: true,
        url:"/playlist/tracks",
        params:{
            op,
            pid,
            tracks,
            timerstamp:Date.now()
        }
    })
}

     //获取歌词
export function lyric(id){
    return request({
        withCredentials: true,
        url:"/lyric",
        params:{
            id,
            timerstamp:Date.now()
        }
    })
}

//歌单收藏者
export function playlist_sub(id){
    return request({
        withCredentials: true,
        url:"/playlist/subscribers",
        params:{
            id,
            timerstamp:Date.now()
        }
    })
}
//获取相似音乐
export function simi_song(id){
      return request({
        withCredentials: true,
        url:'/simi/song',
        params:{
           id
        }
      })
}
//获取相似歌单
export function simi_playlist(id){
    return request({
        withCredentials: true,
        url:'/simi/playlist',
        params:{
            id
        }
    })
}
